package com.zlc.common.core.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.process.model.entity.StoneProcessClass;
import com.zlc.common.core.process.mapper.StoneProcessClassMapper;
import com.zlc.common.core.process.model.vo.StoneProcessClassVo;
import com.zlc.common.core.process.model.vo.StoneProcessVo;
import com.zlc.common.core.process.service.StoneProcessClassService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;

/**
 * @author  zl
 * @date 2023-10-17 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class StoneProcessClassServiceImpl extends BaseServiceImpl<StoneProcessClassMapper, StoneProcessClass, StoneProcessClassVo> implements StoneProcessClassService{

    @Override
    public StoneProcessClassVo getByClassId(String classId) {
        LambdaQueryWrapper<StoneProcessClass> wrapper = wrapper().eq(StoneProcessClass::getClassId, classId);
        return queryOne(wrapper);
    }

    @Override
    public List<StoneProcessClassVo> getByClassIds(List<String> classIds) {
        LambdaQueryWrapper<StoneProcessClass> wrapper = wrapper().in(StoneProcessClass::getClassId, classIds);
        return queryVoList(wrapper);
    }

    @Override
    public List<StoneProcessClassVo> getChildByParentId(String parentId) {
        LambdaQueryWrapper<StoneProcessClass> wrapper =
                wrapper().eq(StoneProcessClass::getParentClassId, parentId);
        return queryVoList(wrapper);
    }
}
